<?

require_once  $_SERVER['DOCUMENT_ROOT']."/../_lib/base/common.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.template.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.holidays.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.photos.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.hotels.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.airports.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.destinations.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.exchange_rates.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.holiday_special_offers.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.lurls.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.tree.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.reviews.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.holiday_top_deals.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.holiday_filters.php";


	$template = new template();
	$template->section_highlight = "holidays";
	$template->left_col = true;
	$template->search_tab = "holidays";
	$template->title = "Holiday Special Offers";
	$template->ld_head();
	
	$lurls = new lurls();
	$holidays = new holidays();
	$destinations = new destinations();
	$hotels = new hotels();
	$airports = new airports();
	$photos = new photos();
	$tree = new tree();
?>







<h2>Holiday Special Offers</h2>
    



<div class="col_360">



<!-- Start offers -->






	
	
	
<?
$specials = new holiday_special_offers();
$current_specials = $specials->get_specials($params);
unset($params);
if(!empty($current_specials)){

$holiday_references = new holiday_references();
$holiday_filters = new holiday_filters();
?>



<!-- Start special offers -->






<?


foreach($current_specials as $special_values){

	// Holiday filter
	$filter_out = false;
	$params['holiday_reference_id'] = $special_values['reference_id'];
	if($holiday_filters->find_filtered_holiday($params)){
		$filter_out = true;
	}
	unset($params);
	
	// Get Holiday values
	$holiday_values = $holiday_references->build_holiday_keys(explode('~',$special_values['string']));

	
	// Filter by date
	if($holiday_values['departure_date']<=date('ymd')){
		$filter_out = true;
	}
	
if(!$filter_out){


	// Get hotel 
	$params['tree_id'] = $special_values['hotel_tree_id'];
	$params['cache']['seconds'] = '2400';
	$lookup = $hotels->lookup_hotel($params);
	unset($params);
	
	// Set values
	$hotel_values = $lookup['hotel_values'];
	$resort_values = $lookup['resort_values'];
	$destination_values = $lookup['destination_values'];


	// get photo url
	$lead_hotel_thumb_url = $tree->photo_url($hotel_values['main_photo']);
	
	// Departure airport lookup
	$params['airport_code'] = $holiday_values['departure_airport'];
	$params['cache']['seconds'] = '2400';
	$departure_airport_values = $airports->get_airport($params);
	unset($params);
	

	// Get the adult display price
	$display_price = floor($holiday_values['price_adult']);

	
	// Get LURL
	$params['reference_id'] = $special_values['reference_id'];
	$params['tree_id'] = $special_values['hotel_tree_id'];
	$offer_lurl = $lurls->get_holiday_lurl($params);
	unset($params);
	
	// Link titles
	$link_title = "Special offer holiday to ".$destination_values['name'];
	
	
?>


<!-- Start offer instance -->
<div class="lowlight offer_body_div" onclick="location='<?= $offer_lurl ?>'" onmouseover="this.className='highlight offer_body_div';" onmouseout="this.className='lowlight offer_body_div';">


<div class="col_110">
    <div class='thumb_cover_div'>
    <a href="<?= $offer_lurl ?>" title="<?= $link_title ?>">
    <img src='<?= $lead_hotel_thumb_url ?>' alt='<?= $hotel_values['name'] ?>' class="thumb_image_100" />
    <img src="/images/thumb_cover_100_74.gif" class="thumb_cover" alt='<?= $hotel_values['name'] ?>'  />
    </a>
    </div>
</div>



<div class="col_240">

<p class="title_big"><a href="<?= $offer_lurl ?>" title="<?= $link_title ?>"><?= $destination_values['name'].", ".$resort_values['name'] ?></a></p>
<p class="title_med"><a href="<?= $offer_lurl ?>" title="<?= $link_title ?>"><?= $hotel_values['name'] ?></a> <?= output_rating($hotel_values['hotel_rating'], "star", true); ?></p>
<p class="no_margin"><?= $holiday_values['nights'] ?> nights, <?= $holidays->board_basis($holiday_values['board_basis']); ?>, from <?= $departure_airport_values[0]['simple'] ?></p>
<p class="no_margin">From <a class="price_med" href="<?= $offer_lurl ?>" title="<?= $link_title ?>">&euro;<?= $display_price ?></a></p>

</div>


<div class="clearing"></div>



</div>
<!-- End offer instance -->


<?

unset($current_specials, $hotel_values,$resort_values,$destination_values,$departure_airport_values, $offer_lurl,$display_price);

}

}

?>
<div style="margin-bottom: 10px"></div>

<!-- End special offers -->


<? } ?>






</div>








<div class="col_250">






<!-- Start banner box -->

<? include SITE_ROOT_PATH."/_lib/html/banners/banner_250_250.php" ?>

<!-- End banner box -->



</div>








<?

	$template->ld_foot();
	
?>